<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是PS封装简介的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV06-01-PS封装-01-PS封装简介">
<meta property="og:url" content="https://sumumm.github.io/post/4240139b.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是PS封装简介的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213935655.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213852521.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213903091.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213912730.png">
<meta property="article:published_time" content="2024-12-17T15:48:43.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.064Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="LV06-音视频封装">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213935655.png">


<link rel="canonical" href="https://sumumm.github.io/post/4240139b.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":"","permalink":"https://sumumm.github.io/post/4240139b.html","path":"post/4240139b.html","title":"LV06-01-PS封装-01-PS封装简介"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV06-01-PS封装-01-PS封装简介 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E4%BB%80%E4%B9%88%E6%98%AFPS%EF%BC%9F"><span class="nav-text">一、什么是PS？</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-PS%E5%B0%81%E8%A3%85%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="nav-text">1. PS封装是什么？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%B8%B8%E8%A7%81%E6%9C%AF%E8%AF%AD"><span class="nav-text">2. 常见术语</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-MPEG%EF%BC%9F"><span class="nav-text">3. MPEG？</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-MPEG-1"><span class="nav-text">3.1 MPEG-1</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-MPEG-2"><span class="nav-text">3.2 MPEG-2</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-MPEG-4"><span class="nav-text">3.3 MPEG-4</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-MPEG-7"><span class="nav-text">3.4 MPEG-7</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-MPEG-21"><span class="nav-text">3.5 MPEG-21</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-6-H-264-AVC"><span class="nav-text">3.6 H.264&#x2F;AVC</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-7-H-265-HEVC"><span class="nav-text">3.7 H.265&#x2F;HEVC</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81PS%E5%B0%81%E8%A3%85%E6%A0%BC%E5%BC%8F%E7%AE%80%E4%BB%8B"><span class="nav-text">二、PS封装格式简介</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-PS%E6%B5%81%E6%A0%BC%E5%BC%8F"><span class="nav-text">1. PS流格式</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-PSH"><span class="nav-text">1.1 PSH</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-PES"><span class="nav-text">1.4 PES</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-H264%E6%B5%81%E7%9A%84PS%E5%B0%81%E8%A3%85"><span class="nav-text">2. H264流的PS封装</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E5%85%B8%E5%9E%8B%E7%9A%84H-264-I%E5%B8%A7-PS%E5%8C%85"><span class="nav-text">2.1 典型的H.264 I帧 PS包</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E5%85%B8%E5%9E%8B%E7%9A%84H-264-P-B%E5%B8%A7PS%E5%8C%85"><span class="nav-text">2.2 典型的H.264 P&#x2F;B帧PS包</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E9%9F%B3%E9%A2%91%E5%85%83%E7%B4%A0%E6%B5%81%E5%B0%81%E8%A3%85%E8%A7%84%E5%88%99"><span class="nav-text">3. 音频元素流封装规则</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/4240139b.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV06-01-PS封装-01-PS封装简介 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV06-01-PS封装-01-PS封装简介
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-12-17 23:48:43" itemprop="dateCreated datePublished" datetime="2024-12-17T23:48:43+08:00">2024-12-17</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/" itemprop="url" rel="index"><span itemprop="name">04音视频</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/" itemprop="url" rel="index"><span itemprop="name">LV06-音视频封装</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>2.6k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>9 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是PS封装简介的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.6的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.0.0 build-20800274</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr><td align="center">参考资料  </td><td align="center">相关链接</td></tr>    <tr><td align="left">H264文档</td><td align="left"><a href="https://gitee.com/sumumm/audio-and-video/raw/master/参考资料/T-REC-H.264-202408-I-E.pdf" target="_blank"> ITU-T Rec. H.264 (08/2024) Advanced video coding for generic audiovisual services </a></td></tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr><td align="left"><a href="" target="_blank">---</a></td><td align="left">---</td></tr></table>
              </div>
            </details>

<h1 id="一、什么是PS？"><a href="#一、什么是PS？" class="headerlink" title="一、什么是PS？"></a><font size=3>一、什么是PS？</font></h1><h2 id="1-PS封装是什么？"><a href="#1-PS封装是什么？" class="headerlink" title="1. PS封装是什么？"></a><font size=3>1. PS封装是什么？</font></h2><p><strong>PS</strong> 是 <strong>Program Stream</strong> 的缩写，有时候也会见到这种名称：<strong>MPEG-2 PS（Program Stream）</strong>，它好像更官方一点吧，都是一个概念。接下来就简答了解一下。</p>
<p>MPEG2-PS是一种多路复用数字音频，视频等的封装容器。PS是Program Stream(程序流或节目流)的简称，是主流的音视频数据封装方式之一。程序流将一个或多个分组但有共同的时间基准的基本数据流(PES)合并成一个整体流。它是为可靠稳定的储存媒介如光盘而设计的。广泛应用于 DVD 等多媒体文件的存储环节，PS主要使用在GB28181中。</p>
<p>PS（Program Stream）封装的标准定义在 <strong>ISO&#x2F;IEC 13818-1</strong> 标准中。该标准是 MPEG-2 系统层的一部分，详细描述了 MPEG-2 PS 的结构、数据流的组织方式、同步机制、错误检测方法等。</p>
<blockquote>
<p>Tips：</p>
<p>ISO&#x2F;IEC 13818-1 标准：信息技术 — 通用编码 — 第1部分：系统（Information technology — Generic coding of moving pictures and associated audio information — Part 1: Systems）</p>
</blockquote>
<h2 id="2-常见术语"><a href="#2-常见术语" class="headerlink" title="2. 常见术语"></a><font size=3>2. 常见术语</font></h2><ul>
<li>PS: Program Stream，mpeg2 第一部分定义的节目流。</li>
<li>TS: Transport Stream, mpeg2 第一部分定义的传输流。</li>
<li>RTP: Real-time Transport Protocol, 实时传输协议。</li>
<li>PES: Packetized Elementary Stream, 封装元素流，PS数据的基本单位。</li>
<li>GOP: Group Of Picture, 图像组，一般指I帧及其后面依靠该I帧解码的其他帧。</li>
<li>NAL: Network Abstraction Layer, 网络适配层，H.264 定义的一个元素结构层次，包括编码数据和参数集信息等。</li>
<li>VCL: Video Coding Layer, 视频编码层，H.264 定义的一个元素结构层次，只包括编码数据。</li>
<li>IDR: Instantaneous Decoding Refresh，解码器立即重刷新。</li>
<li>IVS: Intelligence Video Surveillance，智能视频监控</li>
</ul>
<h2 id="3-MPEG？"><a href="#3-MPEG？" class="headerlink" title="3. MPEG？"></a><font size=3>3. MPEG？</font></h2><p>MPEG（Moving Picture Experts Group）是一个由国际标准化组织（ISO）和国际电工委员会（IEC）联合成立的标准组织，专注于活动图像和声音的编码、解码、压缩和传输。MPEG 标准涵盖了从 MPEG-1 到 MPEG-7 多个版本，每个版本针对不同的应用领域和需求。</p>
<p>下来来了解几个主要的 MPEG 标准及其应用：MPEG-1、MPEG-2、MPEG-4、MPEG-7、H264&#x2F;AVC 和 H265&#x2F;HEVC 。</p>
<h3 id="3-1-MPEG-1"><a href="#3-1-MPEG-1" class="headerlink" title="3.1 MPEG-1"></a><font size=3>3.1 MPEG-1</font></h3><ul>
<li><strong>主要应用</strong>：VCD（Video Compact Disc）、MP3 音频。</li>
<li><strong>特点</strong>：定义了视频和音频的压缩标准，使得视频和音频可以在 CD 等存储介质上存储和播放。</li>
</ul>
<h3 id="3-2-MPEG-2"><a href="#3-2-MPEG-2" class="headerlink" title="3.2 MPEG-2"></a><font size=3>3.2 MPEG-2</font></h3><ul>
<li><strong>主要应用</strong>：DVD、数字电视广播、有线电视。</li>
<li><strong>特点</strong>：扩展了 MPEG-1 的标准，支持更高的分辨率和更高质量的视频和音频。定义了 Program Stream (PS) 和 Transport Stream (TS) 两种容器格式。</li>
</ul>
<h3 id="3-3-MPEG-4"><a href="#3-3-MPEG-4" class="headerlink" title="3.3 MPEG-4"></a><font size=3>3.3 MPEG-4</font></h3><ul>
<li><strong>主要应用</strong>：互联网视频、移动设备、流媒体。</li>
<li><strong>特点</strong>：专注于多媒体内容的高效压缩和传输，支持多种音频和视频编码格式，如 H.264&#x2F;AVC。</li>
</ul>
<h3 id="3-4-MPEG-7"><a href="#3-4-MPEG-7" class="headerlink" title="3.4 MPEG-7"></a><font size=3>3.4 MPEG-7</font></h3><ul>
<li><strong>主要应用</strong>：多媒体内容的描述和检索。</li>
<li><strong>特点</strong>：不是一种编码标准，而是一种多媒体内容描述接口标准，用于描述多媒体内容以支持高效检索。</li>
</ul>
<h3 id="3-5-MPEG-21"><a href="#3-5-MPEG-21" class="headerlink" title="3.5 MPEG-21"></a><font size=3>3.5 MPEG-21</font></h3><ul>
<li><strong>主要应用</strong>：数字版权管理、多媒体内容的交互和分发。</li>
<li><strong>特点</strong>：定义了一个多媒体框架，旨在提供一个统一的框架来处理和管理多媒体内容。</li>
</ul>
<h3 id="3-6-H-264-AVC"><a href="#3-6-H-264-AVC" class="headerlink" title="3.6 H.264&#x2F;AVC"></a><font size=3>3.6 H.264&#x2F;AVC</font></h3><ul>
<li><strong>主要应用</strong>：高清电视、视频会议、互联网视频。</li>
<li><strong>特点</strong>：由 MPEG 和 ITU-T VCEG 联合开发，是一种高效的视频编码标准，广泛应用于高清视频和流媒体领域。</li>
</ul>
<h3 id="3-7-H-265-HEVC"><a href="#3-7-H-265-HEVC" class="headerlink" title="3.7 H.265&#x2F;HEVC"></a><font size=3>3.7 H.265&#x2F;HEVC</font></h3><ul>
<li><strong>主要应用</strong>：超高清电视（UHD）、4K 和 8K 视频。</li>
<li><strong>特点</strong>：继 H.264 之后的下一代视频编码标准，提供更高的压缩效率。</li>
</ul>
<h1 id="二、PS封装格式简介"><a href="#二、PS封装格式简介" class="headerlink" title="二、PS封装格式简介"></a><font size=3>二、PS封装格式简介</font></h1><h2 id="1-PS流格式"><a href="#1-PS流格式" class="headerlink" title="1. PS流格式"></a><font size=3>1. PS流格式</font></h2><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213935655.png" alt="image-20241210213935655" />

<p>一个 PS 流或者文件可以视为多个 PS GOP，每个 GOP 是以 I 帧起始的多帧集合，各 GOP 之间的信息没有相互依赖性，可以进行剪切拼接。一个 PS GOP 由一个或多个 PS 包组成，一个 PS 包内包含一个 PSH(PS Header)和若干个 PES 包，每个 PS GOP 的第一个 PS 包应当在包头 PSH 后立即跟随一个 PSM 包。PSM 包是一种特殊的 PES 包，含有对其他 PES 负载数据类型的描述。PS 包内的其他 PES 的出现顺序和内容没有特殊约束，即一个 PS 包内可以包含交错出现的视频、音频和私有流等 PES 包，各 PES 包根据 PSM 的描述进行拆分。</p>
<h3 id="1-1-PSH"><a href="#1-1-PSH" class="headerlink" title="1.1 PSH"></a><font size=3>1.1 PSH</font></h3><p>PSH (Program Stream pack Header)是 PS 包的包头，主要包含系统时间信息。常用的 PSH 的语法定义如下：</p>
<h3 id="1-4-PES"><a href="#1-4-PES" class="headerlink" title="1.4 PES"></a><font size=3>1.4 PES</font></h3><p>PES, Packetised Elementray Stream, 原始流分组。Elementary Stream, 原始流，指的是视频或音频压缩编码后产生的比特数据，而视频或音频原始流分别打包生成视频PES和音频PES。一个PES分组只包含一个原始流的编码数据。</p>
<h2 id="2-H264流的PS封装"><a href="#2-H264流的PS封装" class="headerlink" title="2. H264流的PS封装"></a><font size=3>2. H264流的PS封装</font></h2><p>（1）一个网络抽象单元（NALU）视为一个处理单元，编码器一帧编码后输出可能是多个处理单元；</p>
<p>（2）除B帧外的帧输出的多个单元封装时应当在第一个单元头部添加PSH；</p>
<p>（3）当一个NALU单元长度超过系统PES包长限制时，可以将该NALU分割成多个PES包，但每个PES包内不应当包含多于1个NALU的数据；</p>
<p>（4）每个帧的第一个处理单元所封装成的第一个PES包包头应当带有PTS；</p>
<p>（5）每个I帧封装时应当在PSH之后添加PSM；</p>
<p>（6）当元素流的基本特性（编码格式，帧率，分辨率，场编码等）发生变化时，变化后的第一帧封装时必须在PSH之后添加PSM；</p>
<h3 id="2-1-典型的H-264-I帧-PS包"><a href="#2-1-典型的H-264-I帧-PS包" class="headerlink" title="2.1 典型的H.264 I帧 PS包"></a><font size=3>2.1 典型的H.264 I帧 PS包</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213852521.png" alt="image-20241210213852521" />

<h3 id="2-2-典型的H-264-P-B帧PS包"><a href="#2-2-典型的H-264-P-B帧PS包" class="headerlink" title="2.2 典型的H.264 P&#x2F;B帧PS包"></a><font size=3>2.2 典型的H.264 P&#x2F;B帧PS包</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213903091.png" alt="image-20241210213903091" />

<h2 id="3-音频元素流封装规则"><a href="#3-音频元素流封装规则" class="headerlink" title="3. 音频元素流封装规则"></a><font size=3>3. 音频元素流封装规则</font></h2><p>（1）在音视频同步时序条件允许的情况下，连续的一个或多个音频帧可以合并，每帧视为一个处理单元；</p>
<p>（2）当音频帧长度不大于PES包负载或网络传输单元所能承受的最大长度时，建议将每个音频帧封装成一个单独的PES包；</p>
<p>（3）每次处理的第一个音频帧所形成的第一个PES包头应当带有PTS，其余音频帧所形成的第一个PES包头建议带有PTS；</p>
<p>（4）当系统不包含视频流时，PSH在流中出现的间隔应当小于1秒，PSM的出现间隔应当小于4秒；当音频参数（码率，采样率，声道数等）发生变化时，必须在变化后立即出现PSH和PSM。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/04%E9%9F%B3%E8%A7%86%E9%A2%91/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/LV06-01-PS%E5%B0%81%E8%A3%85-01-PS%E5%B0%81%E8%A3%85%E7%AE%80%E4%BB%8B/img/image-20241210213912730.png" alt="image-20241210213912730" />





<blockquote>
<p>参考资料：</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/heli200482128/article/details/127037069">H264码流中SPS PPS详解_h264 sps pps-CSDN博客</a></p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/yjkhtddx/article/details/107704932">GB&#x2F;T28181数据流分析学习笔记1：PS数据格式解析_gb28181学习笔记 百度网盘-CSDN博客</a></p>
<p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/heiche/p/6895306.html">海康视频录像文件打包格式解析 - 黑车司机 - 博客园</a></p>
<p><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/89045bbef176">PS流包格式之PS&#x2F;SYS&#x2F;PSM&#x2F;PES头 - 简书</a></p>
<p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/shawn-meng/articles/16305596.html">PS流及其封装 - shunxiang - 博客园</a></p>
</blockquote>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/4240139b.html">LV06-01-PS封装-01-PS封装简介</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2024年12月17日 - 23:48</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/4240139b.html" title="LV06-01-PS封装-01-PS封装简介">https://sumumm.github.io/post/4240139b.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/LV06-%E9%9F%B3%E8%A7%86%E9%A2%91%E5%B0%81%E8%A3%85/" rel="tag"><i class="fa fa-tag"></i> LV06-音视频封装</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/f0d6f3bf.html" rel="prev" title="LV06-音视频封装-readme">
                  <i class="fa fa-angle-left"></i> LV06-音视频封装-readme
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/665bb199.html" rel="next" title="LV05-02-H264-12-02-指数哥伦布编码">
                  LV05-02-H264-12-02-指数哥伦布编码 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
